/*
 * UserInfo.cpp
 *
 *  Created on: 2014-1-7
 *      Author: root
 */

#include "UserInfo.h"

namespace miniGameServer {

pthread_mutex_t UserInfo::idMutex = PTHREAD_MUTEX_INITIALIZER;
int UserInfo::idd = 10;

int UserInfo::getNewId()
{
	pthread_mutex_lock(&idMutex);
	int id1 = idd++;
	pthread_mutex_unlock(&idMutex);
	return id1;
}

UserInfo::UserInfo() {
	uid = getNewId();
}

UserInfo::~UserInfo() {
	pthread_mutex_destroy(&idMutex);
}

}
